package cn.tedu.csmall.product.controller;

import cn.tedu.csmall.product.pojo.dto.BrandCategoryAddNewDTO;
import cn.tedu.csmall.product.service.impl.BrandCategoryServiceImpl;
import cn.tedu.csmall.product.web.JsonResult;
import com.github.xiaoymin.knife4j.annotations.ApiOperationSupport;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiModelProperty;
import io.swagger.annotations.ApiOperation;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

@Slf4j
@RestController
@Api(tags = "06. 品牌类别管理模块")
@RequestMapping("/brandCategories")
public class BrandCategoryController {

    @Autowired
    BrandCategoryServiceImpl service;

    @PostMapping("/add-new")
    @ApiOperation(value = "添加品牌类别")
    @ApiOperationSupport(order = 101)
    public JsonResult<Void> addNew(BrandCategoryAddNewDTO dto){
        log.debug("开始处理[添加品牌类别]的请求");
        service.addNew(dto);
        return JsonResult.ok();
    }

    @PostMapping("/delete")
    @ApiOperation(value = "解绑品牌类别")
    @ApiOperationSupport(order = 201)
    public JsonResult<Void> delete(Long categoryId, Long brandId){
        log.debug("开始处理[解绑品牌类别]的请求");
        service.delete(categoryId, brandId);
        return JsonResult.ok();
    }
}
